package com.epam.Runner;

import java.io.FileReader;
import java.util.Properties;
import java.util.Queue;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingQueue;

import org.apache.log4j.Logger;
import org.apache.log4j.PropertyConfigurator;

import com.epam.Bank.Bank;
import com.epam.Client.Client;

public class Main {

	Logger log = Logger.getLogger(Main.class);
	private static BlockingQueue<Client> clients = new LinkedBlockingQueue<Client>(50);

	public static Client getClient() {
		try {
			return clients.take();
		} catch (InterruptedException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return null;
	}

	public static Queue<Client> getClients() {
		return clients;
	}

	public static void main(String[] args) throws Exception {
		Properties prop = new Properties();
		prop.load(new FileReader("src/main/resources/log4j.properties"));
		PropertyConfigurator.configure(prop);
		Bank.rateInitialization();
		WorkDay monday = new WorkDay();
		monday.init();
	}

	public static void setClients(Client c) {
		try {
			Main.clients.put(c);
		} catch (InterruptedException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}

}
